package com.hxl.aop.handler;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author 霍帅帅
 * @since 2024-06-11 23:47
 */
@Component
@Aspect
public class LoveAnnotationHandler {
    /**
     * 定义切点
     */
    @Pointcut("execution(* com.hxl.aop.service.*.*(..)) || execution(* com.hxl.aop.entity.*.*(..))")
    public void sayLove(){

    }
    /**
     * 前置通知
     */
    @Before("sayLove()")
    public void startSayLove(){
        System.out.println("要开始说了");
    }
    /**
     * 后置通知
     */
    @After("sayLove()")
    public void endSayLove(){
        System.out.println("说完了");
    }
}
